package tgc.edu.szxt.demo.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;

import tgc.edu.szxt.demo.entity.SysRole;
import tgc.edu.szxt.demo.entity.SysUser;
import tgc.edu.szxt.demo.security.UserUtils;
import tgc.edu.szxt.demo.service.SysUserService;

@Controller
@SessionAttributes(value = {"user"})
public class MainController {
	@Autowired    
	private UserUtils userUtils;

	@Autowired
	private SysUserService userService;
	
	@RequestMapping(value = {"/","/login"},method =RequestMethod.GET)
	public String login() {
		return "login";
	}
	
	@RequestMapping(value = "/main")
	public void main(ModelMap modelMap) {
		SysUser use1 = userUtils.getUser();
		SysUser user= new SysUser();
		user.setName(use1.getName());
		System.out.println();
		modelMap.put("user", user);
	}
	
	@RequestMapping(value = "/stuMain")
	public String stuMain() {
		return "stuMain";
	}
	
	
}
